home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Comm / AmiTCP30b2.lha / netinclude / netinet / tcp.h < prev    next >
C/C++ Source or Header  |  1993-08-01  |  4KB  |  107 lines

  1. /*
  2.  * $Id: tcp.h,v 1.3 1993/06/30 05:45:25 jraja Exp $
  3.  *
  4.  * HISTORY
  5.  * $Log: tcp.h,v $
  6.  * Revision 1.3  1993/06/30  05:45:25  jraja
  7.  * Changed bitfield definitions to be more like ANSI-C.
  8.  *
  9.  * Revision 1.2  1993/03/03  21:27:41  jraja
  10.  * Added #ifdef to prevent multiple inclusion.
  11.  *
  12.  * Revision 1.1  92/11/17  16:30:05  16:30:05  jraja (Jarno Tapio Rajahalme)
  13.  * Initial revision
  14.  * 
  15.  *
  16.  */
  17.  
  18. /*
  19.  * Copyright (c) 1982, 1986 Regents of the University of California.
  20.  * All rights reserved.
  21.  *
  22.  * Redistribution and use in source and binary forms, with or without
  23.  * modification, are permitted provided that the following conditions
  24.  * are met:
  25.  * 1. Redistributions of source code must retain the above copyright
  26.  *    notice, this list of conditions and the following disclaimer.
  27.  * 2. Redistributions in binary form must reproduce the above copyright
  28.  *    notice, this list of conditions and the following disclaimer in the
  29.  *    documentation and/or other materials provided with the distribution.
  30.  * 3. All advertising materials mentioning features or use of this software
  31.  *    must display the following acknowledgement:
  32.  *    This product includes software developed by the University of
  33.  *    California, Berkeley and its contributors.
  34.  * 4. Neither the name of the University nor the names of its contributors
  35.  *    may be used to endorse or promote products derived from this software
  36.  *    without specific prior written permission.
  37.  *
  38.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  39.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  40.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  41.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  42.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  43.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  44.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  45.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  46.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  47.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  48.  * SUCH DAMAGE.
  49.  *
  50.  *    @(#)tcp.h    7.7 (Berkeley) 6/28/90
  51.  */
  52.  
  53. #ifndef TCP_H
  54. #define TCP_H
  55.  
  56. typedef    u_long    tcp_seq;
  57. /*
  58.  * TCP header.
  59.  * Per RFC 793, September, 1981.
  60.  */
  61. struct tcphdr {
  62.     u_short    th_sport;        /* source port */
  63.     u_short    th_dport;        /* destination port */
  64.     tcp_seq    th_seq;            /* sequence number */
  65.     tcp_seq    th_ack;            /* acknowledgement number */
  66. #if BYTE_ORDER == LITTLE_ENDIAN 
  67.     u_char    th_x2:4;        /* (unused) */
  68.     u_char    th_off:4;        /* data offset */
  69. #endif
  70. #if BYTE_ORDER == BIG_ENDIAN 
  71.     u_char    th_off:4;        /* data offset */
  72.     u_char    th_x2:4;        /* (unused) */
  73. #endif
  74.     u_char    th_flags;
  75. #define    TH_FIN    0x01
  76. #define    TH_SYN    0x02
  77. #define    TH_RST    0x04
  78. #define    TH_PUSH    0x08
  79. #define    TH_ACK    0x10
  80. #define    TH_URG    0x20
  81.     u_short    th_win;            /* window */
  82.     u_short    th_sum;            /* checksum */
  83.     u_short    th_urp;            /* urgent pointer */
  84. };
  85.  
  86. #define    TCPOPT_EOL    0
  87. #define    TCPOPT_NOP    1
  88. #define    TCPOPT_MAXSEG    2
  89.  
  90. /*
  91.  * Default maximum segment size for TCP.
  92.  * With an IP MSS of 576, this is 536,
  93.  * but 512 is probably more convenient.
  94.  * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
  95.  */
  96. #define    TCP_MSS    512
  97.  
  98. #define    TCP_MAXWIN    65535        /* largest value for window */
  99.  
  100. /*
  101.  * User-settable options (used with setsockopt).
  102.  */
  103. #define    TCP_NODELAY    0x01    /* don't delay send to coalesce packets */
  104. #define    TCP_MAXSEG    0x02    /* set maximum segment size */
  105.  
  106. #endif /* !TCP_H */
  107.